package com.qijian.maindata.domain.query;


import com.qijian.common.utils.mybatis.WhereType;
import com.qijian.common.utils.mybatis.WhereTypeEnum;
import lombok.Data;

import java.util.List;
import java.util.Set;
import lombok.ToString;
import com.baomidou.mybatisplus.annotation.TableName;


/**
 * 核算派工-流程主(核算)对象 查询条件类
 *
 * @author qijian
 * @date 2024-10-22
 */

@Data
@ToString
@TableName("main_adjust_order_flow")
public class AdjustOrderFlowQuery {

    @WhereType(filed = "id")
    private Long id;
    @WhereType(filed = "id", type = WhereTypeEnum.IN)
    private List<Long> ids;
    @WhereType(filed = "title")
    private String title;
    @WhereType(filed = "number")
    private String number;
    @WhereType(filed = "apply_id")
    private Long applyId;
    @WhereType(filed = "apply_name")
    private String applyName;
    @WhereType(filed = "apply_dept_id")
    private Long applyDeptId;
    @WhereType(filed = "apply_dept_name")
    private String applyDeptName;
    @WhereType(filed = "remark")
    private String remark;


    // 流程相关查询
    @WhereType(ignore= true)
    private List<String> approvalStatus;

    @WhereType(tableName = "main_flow", filed = "approval_status" ,type = WhereTypeEnum.IN)
    private List<String> approve;


    @WhereType(func = "EXISTS (select 1 from t_flowable_record f inner join main_flow m on f.source_id = m.id  " +
            "       where m.target_dept_id = main_adjust_order_flow.id " +
            "       and f.business_key= 'flow_adjustOrder' and f.user_id ={1})")
    private Long u;


    @WhereType(func = "EXISTS (select 1 from t_flowable_record f left join ACT_RU_TASK ru on ru.PROC_INST_ID_=f.process_instance_id " +
            "inner join ACT_HI_IDENTITYLINK i on i.TASK_ID_=ru.ID_ " +
            " where main_flow.id = f.source_id and f.business_key= 'flow_adjustOrder'  and ( ru.ASSIGNEE_ ={1} or i.USER_ID_ = {1} ))")
    private Long i;

    @WhereType(deptTableName = "sys_user", userTableName = "sys_user")
    private Boolean dataScope;


    @WhereType(fields = {"main_adjust_order_flow.title","main_adjust_order_flow.number","main_adjust_order_flow.apply_name","main_adjust_order_flow.apply_dept_name"},type = WhereTypeEnum.LIKE)
    private String condition;

    @WhereType(filed = "projectNoList" ,tableName = "main_adjust_order_flow_detail",type = WhereTypeEnum.LIKE)
    private String projectNo;

}
